#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int solve(int m, int n)
{
    int count = 0;
    int i = m ^ n;
    while (i)
    {
        i = i & (i - 1);
        count++;
    }
    return count;
}

int main()
{
    int m = 0;
    int n = 0;
    scanf("%d %d", &m, &n);
    int ret = solve(m, n);
    printf("%d", ret);
    return 0;
}